home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr26
/
netprog.zip
/
NETPROG.TAR
/
ipc
/
mainfifoserv.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-12-17
|
642b
|
31 lines
#include "fifo.h"
main()
{
int readfd, writefd;
/*
* Create the FIFOs, then open them - one for reading and one
* for writing.
*/
if ( (mknod(FIFO1, S_IFIFO | PERMS, 0) < 0) && (errno != EEXIST))
err_sys("can't create fifo: %s", FIFO1);
if ( (mknod(FIFO2, S_IFIFO | PERMS, 0) < 0) && (errno != EEXIST)) {
unlink(FIFO1);
err_sys("can't create fifo: %s", FIFO2);
}
if ( (readfd = open(FIFO1, 0)) < 0)
err_sys("server: can't open read fifo: %s", FIFO1);
if ( (writefd = open(FIFO2, 1)) < 0)
err_sys("server: can't open write fifo: %s", FIFO2);
server(readfd, writefd);
close(readfd);
close(writefd);
exit(0);
}